Using `rack-rewrite` to Remove the Month and Date from a Permlink

Posted by Bryan Veloso on Stack Overflow See other posts from Stack Overflow or by Bryan Veloso
Published on 2012-07-11T09:12:00Z Indexed on 2012/07/11 9:15 UTC
Read the original article Hit count: 225

Filed under:
|
|
|

I've started the process of moving my blog to Octopress, but unfortunately, a limitation of Jekyll doesn't allow me to use abbreviated month names for my permalinks. Therefore I'm looking to just get rid of the month and day bits altogether.

I'ved read in this article that you can use rack-rewrite to take care of the redirection, since I am using Heroku to host this.

So how would I turn:

This: example.com/journal/2012/jan/03/post-of-the-day/
Into this: example.com/journal/2012/post-of-the-day/


Extra points: If I had another rule that redirected /blog/ to /journal/, would that rule still adhere to the above one as well? So from:

This: example.com/blog/2012/jan/03/post-of-the-day/
To this: example.com/journal/2012/jan/03/post-of-the-day/
And finally to: example.com/journal/2012/post-of-the-day/

Thanks for the assistance in advance. :)

© Stack Overflow or respective owner

Related posts about regex

Related posts about rack